package com.example.server.mapper;

import com.example.server.entity.User;
import org.apache.ibatis.annotations.*;

import java.util.List;
@Mapper
public interface UserMapper {
    @Select("select * from sys_user")
    List<User> findAll();
    @Select("select * from sys_user where username=#{username}")
    List<User> findByName(String username);
    @Insert("insert into sys_user(id,username,password,phone)values(#{id},#{username},#{password},#{phone})")
    Integer save(User user);
    @Delete("delete from sys_user where id=#{id}")
    Integer deleteById(@Param("id") Integer id);

    @Select("select * from sys_user limit #{pageNum},#{pageSize}")
    List<User> selectPage(Integer pageNum,Integer pageSize);
    @Select("select count(*) from sys_user")
    Integer selectTotal();
}
